/*
 * @Autor: zengy
 * @Date: 2021-07-16 13:39:56
 * @LastEditors: zengy
 * @LastEditTime: 2021-07-16 13:46:18
 * @Description: 
 * @FilePath: \Mics3.0_3DViewer_WEB\3DViewer\src\utils\getFont.js
 */

let fs=require('fs'),
    files,
    content=[];

let  walk=function(dir,exclude) {
    let results = [];
    let  list = fs.readdirSync(dir);
    list.forEach(function(file) {
        file = dir + '/' + file;
        let stat = fs.statSync(file);
        if(stat&& stat.isDirectory()){           
            results = results.concat(walk(file))
        }else{
            if(/.(vue|html|js)$/.test(file)){ //也可以是其它文档比如json，后缀名添加上即可
                results.push(file)
            }    
        } 
    });
    return results
};

((dir)=>{
    files=walk(dir);
    console.log(files)
    files.forEach(file=>{
        let text=fs.readFileSync(file);
        text.toString().split('').forEach(letter=>{
            if(/[a-zA-Z0-9\u4e00-\u9fa5]/.test(letter)&&content.indexOf(letter)==-1){
                content.push(letter);
            }
        })    
    })
    console.log(content.join(''));
})('../../src');
